//
//  HRSelectFriendsTableViewCell.m
//  SpeedDating
//
//  Created by ISU1 on 17/2/8.
//  Copyright © 2017年 isu. All rights reserved.
//

#import "FriendRemindWhocell.h"

@interface FriendRemindWhocell ()

@property (nonatomic, strong) UIImageView *selectImageView;

@property (nonatomic, strong) UIImageView *headImageView;

@property (nonatomic, strong) UILabel *nickNameLabel;

@end

@implementation FriendRemindWhocell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        _selectImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:_selectImageView];
        [_selectImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.contentView);
            make.left.equalTo(self.contentView).offset(15);
            make.height.width.mas_equalTo(24);
        }];
        _headImageView = [UIImageView new];
        _headImageView.layer.cornerRadius = 20;
        _headImageView.layer.masksToBounds = YES;
        [self.contentView addSubview:_headImageView];
        [_headImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_selectImageView.mas_right).offset(15);
            make.centerY.equalTo(self.contentView);
            make.height.width.mas_equalTo(40);
        }];
        _nickNameLabel = [UILabel new];
        [self.contentView addSubview:_nickNameLabel];
    }
    return self;
}

- (void)setIsSelect:(BOOL)isSelect {
    if (isSelect) {
        _selectImageView.image = [UIImage imageNamed:@"Friend_news_selected_button"];
    } else {
        _selectImageView.image = [UIImage imageNamed:@"Friend_news_selected_no"];
    }
}

- (void)setModel:(SDContactModel *)model {
    _nickNameLabel.text = model.name;
    [_nickNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_headImageView.mas_right).offset(10);
        make.centerY.equalTo(self.contentView);
    }];
    if(model.imageName){
       [_headImageView sd_setImageWithURL:[NSURL URLWithString:HttpImgUrl(model.imageName)] placeholderImage:[UIImage imageNamed:@"llustration"]];
    }
    
}

@end
